<template>
	<view class="content">
		<my-top :url="this.url" :topName="topName" :userName="userName"></my-top>
		<view class="indexContent">
			<head-title :titleHead="titleHead" :btnFont="btnFont"></head-title>
			<!-- 	<view class="dormitoryNav">
				<view style="font-weight: 800;font-size: 42rpx;">全部信息
					<view class="leaveLine" ></view>
				</view>
			</view> -->
			<view v-if="instructorHisList.length>0" style="margin-top:-40rpx">
				<view v-for="(item,index) in instructorHisList" :key="index" @click="detailDvFun(item)">
					<view class="mainContentWrap">
						<view style="color:#0000FF;font-weight: 800;font-size: 30rpx;width:80rpx">
							<span style="font-size: 30rpx;margin-right:20rpx;color:#0000FF"></span>
							{{item.className}}
						</view>
						<view style="color:#8F8F94;font-size:28rpx;width:300rpx;width:180rpx">
							{{item.patrolTime}}
						</view>
						<!-- <view @click.stop="del(item)"
							style="margin-top:40rpx;color:#ff0088;font-weight: 800;font-size: 32rpx;width:90rpx">删除
						</view> -->
						<view style="color:#ff0088;font-weight: 800;font-size: 32rpx;">

							{{item.patrolStatus | showStatus}}

						</view>

					</view>
				</view>
				<view class="repDevice" v-if="loadMore">没有更多数据了</view>
			</view>
			<view v-else class="repDevice">暂无违纪记录</view>
		</view>
		<!-- <bottom-com :topName="topName" :bottomArr="attendanceArr" :bottomName="bottomName"></bottom-com> -->
		<!-- <my-bottom  :topName="topName" :bottomArr="attendanceArr" :bottomName="bottomName" ></my-bottom> -->

	</view>
</template>

<script>
	import topCom from '@/pages/component/topCom.vue'
	import bottomCom from '@/pages/component/bottom.vue'
	import headTitle from '@/pages/component/btnHeadeCom.vue'
	export default {
		name: 'leveRegistration',
		filters: {
			showStatus(data) {
				if (data == 1) {
					return "优秀"
				} else if (data == 2) {
					return "良好"
				} else {
					return "差"
				}
			}
		},
		data() {
			return {
				url: "/pages_duty/dutyCheckWorkAttendance/dutyIndex/dutyIndex",
				pageSize: 10,
				pageNum: 1,
				btnFont: "课堂违纪",
				isShowTitle: true,
				isShowList: false,
				userName: '',
				topName: '课堂巡查',
				titleHead: '记录列表',
				bottomName: 'home',
				instructorHisList: [],
				attendanceArr: [{
						name: 'home',
						icon: 'iconfont icon-yonghutongji',
						text: "违纪",
						path: '/pages_duty/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
					},
					{
						name: 'atttendance',
						icon: 'iconfont icon-bi',
						text: "统计",
						path: '/pages_duty/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
					},
					{
						name: 'maintenance',
						icon: 'iconfont icon-shezhi',
						text: "设置",
						path: '/pages_duty/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
					}
				],
				schoolDv: [{
					id: 1,
					title: "着装",
					isShow: false,
				}, {
					id: 2,
					title: "睡觉",
					isShow: false,
				}, {
					id: 3,
					title: "玩游戏",
					isShow: false,
				}, {
					id: 4,
					isShow: false,
					title: "外出"
				}, {
					id: 5,
					isShow: false,
					title: "抽烟"
				}, {
					id: 7,
					title: "迟到",
					isShow: false,
				}, {
					id: 8,
					title: "未戴校牌",
					isShow: false,
				}, {
					id: 9,
					title: "未穿校服",
					isShow: false,
				}, {
					id: 10,
					title: "携带外卖",
					isShow: false,
				}, {
					id: 11,
					title: "校园抽烟",
					isShow: false,
				}, {
					id: 12,
					title: "打架斗殴",
					isShow: false,
				}, {
					id: 13,
					title: "饮酒酗酒",
					isShow: false,
				}, {
					id: 14,
					title: "打牌赌博",
					isShow: false,
				}, {
					id: 15,
					title: "翻爬围墙",
					isShow: false,
				}, {
					id: 16,
					title: "谩骂他人",
					isShow: false,
				}, {
					id: 17,
					title: "携带违禁品",
					isShow: false,
				}, {
					id: 18,
					title: "宿舍抽烟",
					isShow: false,
				}, {
					id: 6,
					title: "其他",
					isShow: false,
				}, ],
				roleName: '',
				loadMore: false,
				total: 0,
			}
		},
		components: {
			topCom,
			bottomCom,
			headTitle,
		},
		mounted() {
			this.getSchoolPatrolPageList()
		},
		onReachBottom() {
			if (this.total >= this.pageNum * this.pageSize) {
				this.pageNum++
				this.getSchoolPatrolPageList()

			} else {
				this.loadMore = true
			}

		},
		onShow() {
			var that = this
			uni.getStorage({
				key: 'userInfo',
				success(res) {
					that.userName = res.data
				}
			})
			uni.getStorage({
				key: 'loginName',
				success: (res) => {
					that.roleName = res.data
				}
			})
		},

		methods: {
			detailDvFun(item) {
				var str = JSON.stringify(item);
				uni.setStorage({
					key: "dutyDetail",
					data: item
				})
				uni.navigateTo({
					url: `/pages_duty/dutyCheckWorkAttendance/dutyPlineDetail?str=${str}`
				})
			},
			del(item) {
				var _this = this
				uni.showModal({
					title: '提示',
					content: '确认取消请假？',
					success: function(res) {
						if (res.confirm) {
							_this.$api.duty.deletePatrolInfo(item.id).then(res => {
								uni.showToast({
									title: "删除成功",
								})
								_this.getSchoolPatrolPageList()
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});


			},
			//  1:宿舍巡查 2:入校早操巡查 3:课堂巡查 4:午休巡查 5:晚自习巡查'
			getSchoolPatrolPageList() {
				this.$api.duty.getSchoolPatrolPageList(3, this.pageSize, this.pageNum).then(res => {
					this.total = res.data.total
					res.data.list.forEach((item, index) => {
						item.classPatrolJson = JSON.parse(item.classPatrolJson)
						item.sleep = item.classPatrolJson.sleep
						item.withoutCard = item.classPatrolJson.withoutCard
						if (item.sleep == 0 && item.withoutCard == 0) {
							item.type = '优秀'
						}
					})
					this.instructorHisList = this.instructorHisList.concat(res.data.list)
				})
			},



		}
	}
</script>

<style>
	.repDevice {
		text-align: center;
		font-size: 32rpx;
		color: #808080;
		margin-top: 50rpx;
	}

	.mainContentWrap {
		border: #8F8F94 solid 0rpx;
		height: 120rpx;
		border-radius: 20rpx;
		margin-top: 30rpx;
		width: 680rpx;
		margin-left: 22rpx;
		box-shadow: 0upx 0upx 10upx 0upx #8F8F94;
		display: flex;
		justify-content: space-around;
		align-content: space-around;
		align-items: center;

	}

	.dormitoryNav {
		color: #0000FF;
		margin-left: 80rpx;
		margin-top: 30rpx;
	}

	.leaveLine {
		width: 200upx;
		height: 8upx;
		background: rgba(239, 220, 11, 1.0);
		opacity: 0.78;
		position: relative;
		bottom: -10rpx;
		left: -30upx;
	}

	.attBtn1 {
		margin-right: 4rpx;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-top: -20rpx;
	}

	.leaveNav {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: row;
		font-size: 36upx;
		color: blue;
		width: 100%;
		padding: 50upx
	}

	.leaveBtn {
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/tubiao-01.png);
		background-size: 100%;
		width: 190upx;
		height: 60upx;
		color: white;
		font-size: 26upx;
		font-weight: 0;
	}

	.leaveLine {
		width: 200upx;
		height: 8upx;
		background: rgba(239, 220, 11, 1.0);
		opacity: 0.78;
		position: relative;
		bottom: -10upx;
		left: -30upx;
	}

	.leaveMgm {
		color: #808080;
		font-size: 28upx;
	}

	.leaveCheck {
		margin-left: 60upx;
		margin-bottom: 30upx;

	}

	.attBtnFontSlec {
		border: solid #007AFF !important;
		border-radius: 15upx;
		font-size: 20upx;
		color: white;
		background-color: #007AFF;
	}

	.attBtnFont {
		border: solid #808080 0rpx !important;
		;
		font-size: 20upx;
	}

	.attBtnFont1 {
		border: solid #808080 0rpx !important;
		;
		font-size: 20upx;
		padding-left: 18rpx !important;
		padding-right: 18rpx !important;
	}

	.attLine {
		width: 700upx;
		height: 3upx;
		background: rgba(239, 237, 236, 1.0);
		opacity: 0.78;
		position: relative;
		bottom: 10upx;
		left: 0upx;
	}

	.attBtn {
		width: 60%;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-top: -20upx;

	}

	.leaveBtn {
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/tubiao-01.png);
		width: 190upx;
		height: 60upx;
		color: white;
		font-size: 26upx;
		font-weight: 0;
	}

	.leaveLine {
		width: 220upx;
		height: 8upx;
		background: rgba(239, 220, 11, 1.0);
		opacity: 0.78;
		position: relative;
		bottom: -10rpx;
		left: -30upx;
	}

	.leaveMgm {
		color: #808080;
		font-size: 28upx;
	}

	.leaveCheck {
		margin-left: 60upx;
		margin-bottom: 30upx;
	}

	.checkout {
		display: flex;
		justify-content: space-around;
		align-content: space-between;
	}

	.leaveTabLine {
		width: 3upx;
		height: 60upx;
		background: #8F8F94;
		opacity: 0.78;
		position: relative;
		top: 0upx;
		left: 150upx;
	}

	.indexContent {
		height: unset !important
	}
</style>